package io.renren.modules.areaem.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.renren.modules.areaem.entity.AreaemployeenumEntity;
import io.renren.modules.welderunnormal.entity.WelderunnormalEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.areaem.entity.AreaemployeeEntity;
import io.renren.modules.areaem.service.AreaemployeeService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-08-04 14:51:53
 */
@RestController
@RequestMapping("areaem/areaemployee")
public class AreaemployeeController {
    @Autowired
    private AreaemployeeService areaemployeeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("areaem:areaemployee:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = areaemployeeService.queryPage(params);

        return R.ok().put("page", page);
    }

    /**
     * 区域信息统计
     */
    @GetMapping("getEmpNum")
    public List<AreaemployeenumEntity> getEmpNum(){
        return areaemployeeService.getEmpNum();
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{areaemployeeNo}")
    @RequiresPermissions("areaem:areaemployee:info")
    public R info(@PathVariable("areaemployeeNo") Integer areaemployeeNo){
		AreaemployeeEntity areaemployee = areaemployeeService.getById(areaemployeeNo);

        return R.ok().put("areaemployee", areaemployee);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("areaem:areaemployee:save")
    public R save(@RequestBody AreaemployeeEntity areaemployee){
		areaemployeeService.save(areaemployee);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("areaem:areaemployee:update")
    public R update(@RequestBody AreaemployeeEntity areaemployee){
		areaemployeeService.updateById(areaemployee);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("areaem:areaemployee:delete")
    public R delete(@RequestBody Integer[] areaemployeeNos){
		areaemployeeService.removeByIds(Arrays.asList(areaemployeeNos));

        return R.ok();
    }

}
